package logger;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class GRIALogger {
	public static boolean log(String message) {

		try {
			FileOutputStream toWrite = new FileOutputStream("log.txt", true);
			PrintStream output = new PrintStream(toWrite);

			output.println(GRIALogger.time() + ": " + message);

		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}

		return true;
	}
	
	private static String time() {
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date();
        return dateFormat.format(date);
    }

}
